The present invention relates in general to automated language identification techniques and in particular to language identification techniques for documents that include portions in multiple languages.
With the proliferation of computing devices and communication networks such as the Internet, an ever increasing amount of information is stored in the form of electronic documents. Such documents might be generated using application software such as word processing programs, e-mail programs, web page development tools, etc. Electronic documents can also be generated by scanning paper documents and employing optical character recognition (“OCR”) or other techniques to create an electronic representation of the content.
It is often necessary to search through a large collection of electronic documents to find information relevant to a particular question. For example, a number of search services provide interfaces via which users can search electronic documents that are accessible via the World Wide Web. In another context, discovery in civil litigation usually involves the production of massive quantities of electronic documents that the receiving party must sift through.
Electronic documents can exist in any human language, and search processes are greatly facilitated if the language of a document is known. For example, in the case of Asian languages, parsing the document into words is non-trivial as most Asian languages do not include a space character between words. Thus, it is helpful to determine which language such documents are in so that they can be correctly parsed into words. As another example, a character string or word might have different meanings in different languages, and search results are generally improved if the language of the documents is known.
A number of automated techniques have been developed to identify the language of a document. Many of these techniques fall into two categories: dictionary-based and n-gram based. In dictionary-based language identification, a “dictionary” is assembled for each of a number of candidate languages, often by analyzing training documents known to be in that language. The document is parsed into “words” (e.g., based on word-break indicators such as space characters and/or punctuation characters), and a frequency analysis is performed on the words to develop a frequency profile for the language. The dictionary for each language can be limited to a relatively small number of commonly occurring words (often short words, e.g., 5 characters or fewer) in that language. The language of an unknown document is determined by parsing the unknown document into words and determining a frequency profile for the unknown document. This frequency profile is compared to the profiles of the candidate languages, and the language with the best match is the language of the document. Dictionary-based techniques can work well for western languages but often fail with Asian languages, since the documents cannot be reliably parsed into words until the language is known.
In n-gram based language identification, the document is parsed into n-character units for some integer n, rather than into words. Typically, n is chosen to be a small number such as 2 or 3, and the n-grams overlap; thus, for example, the word “patent” can be parsed into bigrams (i.e., n-grams with n=2) as “_p”, “pa”, “at”, “te”, “en”, “nt”, “t_”, where “_” denotes the space character. Using a set of training documents in each candidate language, an n-gram frequency profile can be developed for each candidate language. The language of an unknown document can be determined by analyzing the frequency of n-grams and comparing to the frequency profiles of the candidate languages. Using n-grams, particularly bigrams, can significantly reduce the size of the language model, as there are typically fewer possible bigrams than words in a given language. In addition, n-gram analysis does not require prior knowledge of where the word boundaries are, making it particularly suitable for analyzing Asian languages.
Both techniques have usually assumed that the unknown document is in a single language. In reality, some documents are in multiple languages. For example, owner's manuals or instructions for many products are often printed in multiple languages; a contract between entities in different countries might be drafted in two languages, and so on.
Some efforts have been made to adapt the techniques to identify languages for multi-lingual documents. For example, the document can be divided into arbitrary units, e.g., paragraphs, and each paragraph can be analyzed separately. Another approach involves applying the well-known Viterbi algorithm (or a similar algorithm) to find the most probable combination of languages given the text of the document.